package com.restaurant.application.minifacade.data;

import com.google.common.collect.Lists;
import com.nebutown.generation.Convert;
import com.nebutown.generation.PickableBean;
import java.lang.Integer;
import java.lang.String;
import java.util.List;

public class SignInBO implements PickableBean {
    
    public static final String FN_MESSAGE = "message";
    public static final String FN_INTEGRAL = "integral";
    
    public static final List<String> FIELD_NAMES = Lists.newArrayList(
             FN_MESSAGE,
             FN_INTEGRAL);
    
    private String message;
    private Integer integral;
    
    public SignInBO(String message, Integer integral) {
        setMessage(message);
        setIntegral(integral);
    }
    
    public SignInBO() {
    }
    
    public SignInBO duplicate() {
        SignInBO result = new SignInBO();
        result.message = this.message;
        result.integral = this.integral;
        return result;
    }
    
    @Override
    public String toString() {
        return Convert.toJson(this);
    }
    
    public String getMessage() {
        return message;
    }
    
    public void  setMessage(String value) {
        this.message = value;
    }
    
    public SignInBO withMessage(String value) {
        setMessage(value);
        return this;
    }
    
    public SignInBO withMessage(String value, String defaultValue) {
        setMessage(value == null ? defaultValue : value);
        return this;
    }
    
    public Integer getIntegral() {
        return integral;
    }
    
    public void  setIntegral(Integer value) {
        this.integral = value;
    }
    
    public SignInBO withIntegral(Integer value) {
        setIntegral(value);
        return this;
    }
    
    public SignInBO withIntegral(Integer value, Integer defaultValue) {
        setIntegral(value == null ? defaultValue : value);
        return this;
    }
    
    public Object getValueOf(String name) {
        switch(name) {
        case "message": return getMessage();
        case "integral": return getIntegral();
        }
        return null;
    }
    
    public boolean hasField(String name) {
        return FIELD_NAMES.contains(name);
    }
    
    @Override
    public int hashCode() {
        return signature().hashCode();
    }
    
    @Override
    public boolean equals(Object o) {
        if(!(o instanceof SignInBO)) return false;
        return signature().equals(((SignInBO)o).signature());
    }
    
    public String signature() {
        throw new RuntimeException("Bean SignInBO has no signature defined, no hash code or equals possible.");
    }
}
